package com.alpheus.util
{
	
	import flash.display.Sprite;
	
	/**
	 * 素材Util类
	 */
	public class AssetsUtil
	{
		private static var instance:AssetsUtil;
		public static function getInstance():AssetsUtil {
			if (instance == null) instance = new AssetsUtil();
			return instance;
		}
		
		/**
		 *获取遮罩sprite 
		 * @param fillColor
		 * @param width
		 * @param height
		 * @param alpha
		 * @return 
		 * 
		 */		
		public static function getMask(fillColor:uint=0x000000, width:Number=10,height:Number=10,alpha:Number=1):Sprite {
			var s:Sprite = new Sprite();
			//s.graphics.lineStyle(1,lineColor);
			s.graphics.beginFill(fillColor);
			s.graphics.drawRect(0,0,width,height);
			s.graphics.endFill();
			s.alpha=alpha;
			return s;
		}
		
		/**
		 *绘制背景 
		 * @param s
		 * @param fillColor
		 * @param width
		 * @param height
		 * @param alpha
		 * 
		 */		
		public static function drawBg(s:Sprite,fillColor:uint=0x000000, width:Number=10,height:Number=10,alpha:Number=1):void {
			s.graphics.clear();
			s.graphics.beginFill(fillColor,alpha);
			s.graphics.drawRect(0,0,width,height);
			s.graphics.endFill();
		}
		
		/**
		 *根据库里的链接名获取对应的实例 
		 * @param s
		 * @return 
		 * 
		 */		
		public static function getAssetByName(s:String):* {
			return Reflection.createDisplayObjectInstance(s);
		}
		
	}

}